package com.ebook.ui.fragment.home.usercenter;

import com.ebook.entity.User;
import com.ebook.ui.fragment.Fragment;
import com.ebook.ui.sync.WorkSyncer;

public class UserCenter extends Fragment {
    Already_login already_login;
    RegisterLogin registerLogin;
    public UserCenter(){
        super();
        this.setBounds(1071,20,120,40);
        initComponents();
    }
    @Override
    public void initComponents(){
        if(WorkSyncer.loginUser!=null){
            already_login = new Already_login(WorkSyncer.loginUser);
            this.add(already_login);
        }else{
            registerLogin = new RegisterLogin();
            this.add(registerLogin);
//            System.out.println("error"+WorkSyncer.loginUser);
        }

    }
    public void login(User user){
        this.remove(this.registerLogin);
        already_login = new Already_login(user);
        this.add(already_login);
    }
}
